An optical device may include an emitter, a detector and a clear molding compound. The clear molding compound covers the emitter and the detector. The emitter is used for emitting a light beam. The light beam is reflected by an object, and then detected by the detector. However, a portion of the light beam from the emitter may enter the detector directly, which results in cross-talk between the emitter and the detector. Such cross-talk reduces a sensitivity of the detector.